probAlpha <- function(prtrue,k,n){
	# prtrue should exceed .5
	prfalse <- .5-(prtrue-.5)
	dbinom(k,n,prtrue)/(dbinom(k,n,prtrue)+dbinom(k,n,prfalse))
}


n <- 10

ks <-  0:n

probs <- seq(.55,.99,length=20)

plot(c(0,n),c(0,1),type="n")

for(p in probs){

pra <- numeric(length(ks))
for(i in 1:length(ks)){
	pra[i] <- probAlpha(p,ks[i],n)
}

lines(ks,pra,col=grey((1-p)*2),lwd=1.25)

}

filet <- paste("/users/brucedesmarais/Dropbox/professional/Research/Submitted/Camp/Tex/posProb.pdf",sep="")
pdf(filet,width=6,height=5,pointsize=16)
par(las=1,mar=c(4,4,1,1))
n <- 10

ks <-  0:n

probs <- seq(.6,.99,length=20)

plot(c(0,n),c(0,1),type="n",xlab="",ylab="")

for(p in probs){

pra <- numeric(length(ks))
for(i in 1:length(ks)){
	pra[i] <- probAlpha(p,ks[i],n)
}

lines(ks,pra,col=grey((1-p)*1.5),lwd=1.25)

}
title(xlab="Groups Supporting Candidate",line=2.25)
title(ylab=expression(paste("P(Candidate Prefers ", alpha, ") ")),line=2.5)
dev.off()

